from ctaf_core.ctaf_objects.base_bundle import BaseBundle
from ctaf_core.ctaf_resources.ctaf_settings import CTAFsettings
from ctaf_core.ctaf_utils.config_process_util import load_db_settings
from ctaf_core.data_access_bundle.db_session_factory import DataBaseSessionFactory
from ctaf_core.log_trace_bundle.logging import LogRecorder, LoggerFactory


class DataAccessBundle(BaseBundle):

    """
    """
    log_recorder: LogRecorder = LoggerFactory.get_logger()

    def __init__(self) -> None:
        super().__init__("DataAccessBundle")
        self.db_setting_filename: str = CTAFsettings.get_setting("dbSettingFilename")
        self.db_setting = load_db_settings(self.db_setting_filename)

    def load_bundle(self):
        DataBaseSessionFactory.init_db_source(self.db_setting)

    def unload_bundle(self):
        pass